/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.javanile.chess.stone;

/**
 *
 * @author cicciodarkast
 */
public class Board {
    private int[] board;

    public Board() {
	board = new int[Stone.BOARD_LENGTH];
	board = Stone.start.clone();
    }
    public Board(String fen) {
	board = Fen.parse(fen);
    }
    public int get(int s) {
	return board[s];
    }
    public void set(int s, int v) {
	board[s] = v;
    }
    public int turn() {
	return board[Stone.turn];
    }
    public void swap() {
	board[Stone.turn] = -board[Stone.turn];
    }
    public Piece piece(int s) {
	return new Piece(board[s]);
    }
    public void move(int from, int to) {
	board[to]	= board[from];
	board[from]	= 0;	
    }
    public int[] dump() {
	return board;
    }
}
